生活会辜负努力的人,但不会辜负一直努力的人

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

 

 1 void getPostFromPre(int preL, int preR) {
 2     if (preL > preR) return;
 3     int i = preL + 1, j = preR;
 4     while (i <= preR && pre[i] < pre[preL]) i++;
 5     while (j > preL&&pre[j] >= pre[preL]) j--;
 6 
 7     if (i - j != 1) return;
 8     getPostFromPre(preL + 1, j);
 9     getPostFromPre(i, preR);
10     post.push_back(pre[preL]);
11 }

 

posted on 2019-02-10 11:36  何许亻也  阅读(441)  评论(1编辑  收藏  举报